//
//  UIScrollView+Add.m
//  AtCar
//
//  Created by 代佳宏 on 2020/12/4.
//  Copyright © 2020 车一转. All rights reserved.
//

#import "UIScrollView+Add.h"

#import "FSRefreshHeader.h"
#import "FSRefreshFooter.h"

@implementation UIScrollView (Add)

- (void)addRefeshHeader:(MJRefreshComponentAction)refreshingBlock {
    self.mj_header = [FSRefreshHeader headerWithRefreshingBlock:refreshingBlock];
}

- (void)addRefreshFooter:(MJRefreshComponentAction)refreshingBlock {
    self.mj_footer = [FSRefreshFooter footerWithRefreshingBlock:refreshingBlock];
}

- (void)endRefreshing {
    if (self.mj_header.isRefreshing) {
        [self endHeaderRefreshing];
    }
    if (self.mj_footer.isRefreshing) {
        [self endFooterRefreshing];
    }
}

- (void)beginHeaderRefreshing {
    [self.mj_header beginRefreshing];
}

- (void)endHeaderRefreshing {
    [self.mj_header endRefreshing];
}

- (void)beginFooterRefreshing {
    [self.mj_footer beginRefreshing];
}

- (void)endFooterRefreshing {
    [self.mj_footer endRefreshing];
}

- (void)endFooterRefreshingWithNoMoreData {
    [self.mj_footer endRefreshingWithNoMoreData];
}

@end
